﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using System.Diagnostics;

namespace DemoData.Model
{
    public class Product : ModelBase
    {
        [StringLengthValidator(3, 50)]
        public string ProductName { get; set; }

        [RangeValidator(0d, RangeBoundaryType.Inclusive, 3000d, RangeBoundaryType.Inclusive)]
        public double Price { get; set; }

        public Product()
        {
        }

        public Product(int productId, string productName, double price)
            : this(productName, price)
        {
            this.Id = productId;
        }

        public Product(string productName, double price)
        {
            Debug.Assert(!string.IsNullOrEmpty(productName));
            if (string.IsNullOrEmpty(productName))
            {
                throw new ArgumentNullException("productName");
            }

            this.ProductName = productName;
            this.Price = price;
        }
    }
}
